package cn.driver.car.service.Impl;

import cn.driver.car.mapper.CarMapper;
import cn.driver.car.service.CarService;
import cn.driver.common.pojo.Car;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarServiceImpl implements CarService {
    @Autowired
    private CarMapper carMapper;

    @Override
    public List<Car> getCarList() {
        return carMapper.getCarList();
    }

    @Override
    public int addCar(Car car) {
        return carMapper.addCar(car);
    }

    @Override
    public int updateCar(Car car) {
        return carMapper.updateCar(car);
    }


    @Override
    public int deleteCar(String carNo) {
        return carMapper.deleteCar(carNo);
    }

    @Override
    public List<Car> getList(int pageNum, int pageSize) {
        //使用分页插件,核心代码就这一行
        PageHelper.startPage(pageNum, pageSize);
        // 获取
        List<Car> typeList = carMapper.getCarList();
        return typeList;
    }

    @Override
    public List<Car> mohuList(String carNo) {
        return carMapper.mohuList(carNo);
    }
}
